/*
 * This is written by Lulu Han.
 * E-mail: locomotive_crypto@163.com
 */
// Secure Equal Test
#ifndef PPSPD_SEC_SET_H
#define PPSPD_SEC_SET_H

#include "sec_mul.h"

class SecSet{
public:
	class CloudA{
	public:
		CloudA(const PrivateKey& pri);
	
		void set_vlen(long vlens);
		void dec_reenc(const NTL::ZZ& nca, const NTL::ZZ& ncb, NTL::ZZ& cmul);
		void dec_gen_beta(const NTL::ZZ& ct, NTL::ZZ& cbeta);
		
	private:
		long m_nlens, m_vlens;
		Decryptor m_dec;
		SecMul::CloudA m_mulA;
	};
	
	class CloudB{
	public:
		CloudB(const PublicKey& pub);
		
		void set_vlen(long vlens);
		
		void calc_sub(const NTL::ZZ& cx, const NTL::ZZ& cy);
		void gen_two_ciphers(NTL::ZZ& nca, NTL::ZZ& ncb);
		void calc_expr(const NTL::ZZ& cmul, NTL::ZZ& ct);
		void gen_res(const NTL::ZZ& cbeta, NTL::ZZ& res);
		
	private:
		long m_nlens, m_vlens;
		Encryptor m_enc;
		SecMul::CloudB m_mulB;
		NTL::ZZ m_d, m_alpha;
	};
};


#endif // PPSPD_SEC_SET_H
